﻿#include "pixmapitem.h"

pixmapItem::pixmapItem(const QString& path,QGraphicsScene*scene)
{
    pixmap.load(path);
    pixmap=pixmap.scaled(pixmap.width()/6,pixmap.height()/6,Qt::KeepAspectRatio,Qt::SmoothTransformation);
    scene->addItem(this);
}

QRectF pixmapItem::boundingRect() const
{
    return QRectF(-pixmap.width()/2,-pixmap.height(),pixmap.width(),pixmap.height());
}

void pixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    painter->drawPixmap(QPoint(-pixmap.width()/2,-pixmap.height()),pixmap);
}
